/*-----------------------------------------------------------------------------
Archivo:      test_shifter4.c
Autor:	      Cesar Armando Fuguet Tortolero
	            Debe compilarse con la herramienta genpat.
------------------------------------------------------------------------------*/

#include <stdio.h>
#include "genpat.h"

char* inttostr(int entier) {
  char* str;
  str = (char *) mbkalloc (32 * sizeof(char));
  sprintf(str,"%d",entier);
  return(str);
}

main() {
 
  DEF_GENPAT("test_pipeline_vrf_to_alu");

  DECLAR("data_in"    ,":2","B", IN   ,	"7 downto 0"  , "");
  DECLAR("clk_i"        ,":2","B", IN   ,	      ""      , "");
  DECLAR("data_out"   ,":2","B", OUT  ,	"7 downto 0"  , "");

  LABEL("pipeline");
  
  SETTUNIT("ns");

  AFFECT("0"    , "data_in"  , "0b00000000");
  AFFECT("0"    , "clk_i" , "0");

  int i = 0;
  for(i; i<10; i++) {  
    AFFECT("+50","clk_i",inttostr(i%2));
	 if ( i%3 == 0 )
		 AFFECT("+0","data_in","0b01010101");
	 else
		 AFFECT("+0","data_in","0b11001010");
  }


  SAV_GENPAT();

  exit(0);
}

